home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Tools & Apps / Networking & Communications / Serial NB Sample Driver / Task / inc / close.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-11-15  |  1.5 KB  |  84 lines  |  [TEXT/MPS ]

  1. /********************************************************************************/
  2. /*                                                                                */
  3. /*        close.c - close request processing.                                        */
  4. /*                                                                                */
  5. /*        Richard W. Mincher.  February 19, 1990.                                    */
  6. /*                                                                                */
  7. /*        Copyright © 1990 Apple Computer, Inc.  All rights reserved.                */
  8. /*                                                                                */
  9. /********************************************************************************/
  10.  
  11. #include    "AROSE.h"
  12. #include    "os.h"
  13. #include    "managers.h"
  14.  
  15. #include    "ARDriver.h"
  16. #include    "ARTask.h"
  17.  
  18. pascal void illegal()
  19.     extern    0x4afc;
  20.  
  21. CloseCall()
  22. {
  23.     short            s;
  24.     AROSEmessage    *m;
  25.     tid_type        temp;
  26.     
  27. #ifdef    DEBUG
  28.     printf("Close received.\n");
  29. #endif    DEBUG
  30.     open = 0;
  31.  
  32. //    Disable pesky SCC interrupts.
  33.  
  34.     s = Spl(7);
  35.     *SCCControl = 0x09;
  36. #ifdef    PORTA
  37.     *SCCControl = 0x80;
  38. #endif
  39. #ifdef    PORTB
  40.     *SCCControl = 0x40;
  41. #endif
  42.     (void)Spl(s);
  43.     
  44. //    Reply to outstanding Write requests.
  45.     
  46.     while(m = G->txQHead)
  47.     {
  48.         G->txQHead = G->txQHead->mNext;
  49.         temp = m->mFrom;
  50.         m->mFrom = m->mTo;
  51.         m->mTo = temp;
  52.         m->mStatus = -27;
  53.         m->mCode |= 1;
  54.         Send(m);
  55.     }
  56.  
  57. //    Reply to outstanding Read requests.
  58.     
  59.     while(m = G->rxQHead)
  60.     {
  61.         G->rxQHead = G->rxQHead->mNext;
  62.         temp = m->mFrom;
  63.         m->mFrom = m->mTo;
  64.         m->mTo = temp;
  65.         m->mStatus = -27;
  66.         m->mCode |= 1;
  67.         Send(m);
  68.     }
  69.  
  70.  
  71. //    Free transmit buffer.
  72.  
  73.     FreeMem( G->txFirst );
  74.     if (G->txSignal)
  75.         FreeMsg( G->txSignal );
  76.  
  77. //    Free receive and buffer.
  78.  
  79.     FreeMem( G->rxFirst );
  80.     if (G->rxSignal)
  81.         FreeMsg( G->rxSignal );
  82. }
  83.  
  84.